#! /bin/bash

read -p "输入目录:" dir
if [ -d $dir ];then
    echo "目录存在"
    cd $dir
    touch file.txt
    echo "创建文件成功"
    echo "hello world" > file.txt
    echo "写入文件成功"
else
    echo "目录不存在"
    mkdir $dir
    echo "创建目录成功"
    cd $dir
fi